import { MidwayConfig } from '@midwayjs/core';
import { join } from 'path';

export default {
  // use for cookie sign key, should change to your own and keep security
  // use for cookie sign key, should change to your own and keep security
  keys: '1756872712602_bbl_stick',
  cookies: {
    tokenKey: 'bbl_stick_token'
  },
  koa: {
    port: 7002
  },
  busboy: {
    tmpdir: join(__dirname, '../../tmp')
  },
  crypto: {
    salt: 'bbl-stick-salt'
  },
  jwt: {
    secret: 'APP_BBL_STICK',
    sign: { expiresIn: '2h' },
    verify: { algorithms: ['HS256'] }
  },
  midwayLogger: {
    default: {
      level: 'info'
    }
  },
  cacheManager: {
    clients: {
      default: {
        store: 'memory'
      }
    }
  },
  cos: {
    appId: '1329058988',
    secretId: 'AKIDJSqDRRDmARAi3C8qLdjbP4Xm5c1C9tPh',
    secretKey: 'B9ta5TfdOwGQMguvjNq9HFzWpvoUxCE8',
    bucket: 'bbl-1329058988',
    region: 'ap-beijing'
  },
  wxapp: {
    appid: 'wx81b768de8e42ea6e',
    secret: 'e37bef92e6eacb9d9867110c4db1ac47',
    token_grant_type: 'client_credential',
    token_url: 'https://api.weixin.qq.com/cgi-bin/stable_token',
    login_grant_type: 'authorization_code',
    login_url: 'https://api.weixin.qq.com/sns/jscode2session',
    phone_url: 'https://api.weixin.qq.com/wxa/business/getuserphonenumber'
  },
  typeorm: {
    dataSource: {
      default: {
        type: 'mysql',
        host: '49.232.246.61',
        port: 12306,
        username: 'bbl_stick_test',
        password: 'L4fyR3ysBPDDfGsW',
        database: 'bbl_stick_test',
        entities: [
          'entity', // 特定目录
          '**/*.entity.{j,t}s'
        ],
        synchronize: true,
        logging: true
      }
    }
  },
  apiKeyWordWhiteList: ['/open-api/']
} as MidwayConfig;
